package hcn.protocol.brandnew.zhenliao.zhenduan;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import lombok.Data;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;
import java.util.List;


/**
 * 门诊处方信息新增-响应消息（成功） - ODS_03040001_SUC
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "Data")
@XmlAccessorType(XmlAccessType.FIELD)
public class SavePrescriptionInformationResponse {

    /**
     * 处方列表
     */
    @XmlElementWrapper(name = "RecipeLists")
    @XmlElement(name = "RecipeList")
    private List<RecipeList> recipeLists;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PrescriptionDrug {

        /**
         * 外部处方明细id
         */
        @XmlElement(name = "OnlinePrescriptionDetailId")
        private String onlinePrescriptionDetailId;
        /**
         * 处方明细序号
         */
        @XmlElement(name = "PrescriptionDetailId")
        private String prescriptionDetailId;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class RecipeList {

        /**
         * 处方记录号
         */
        @XmlElement(name = "PrescriptionRecordId")
        private String prescriptionRecordId;
        /**
         * 处方审核结果
         */
        @XmlElement(name = "AuditStatus")
        private int auditStatus;
        /**
         * 外部处方明细id
         */
        @XmlElement(name = "OnlinePrescriptionRecordId")
        private String onlinePrescriptionRecordId;
        /**
         * 处方编号
         */
        @XmlElement(name = "RecipeNumber")
        private String recipeNumber;
        /**
         * 处方开立日期
         */
        @XmlElement(name = "PrescriptionDate")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date prescriptionDate;
        /**
         * 处方过期时间
         */
        @XmlElement(name = "ExpirationDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date expirationDateTime;
        /**
         * 处方药品集合
         */
        @XmlElementWrapper(name = "PrescriptionDrugs")
        @XmlElement(name = "PrescriptionDrug")
        private List<PrescriptionDrug> prescriptionDrugs;
    }

}
